home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 July / macformat52.iso / mac / Shareware Plus / Developers / YAAF v1.0 alpha 1 / (Samples) / Text Display / Code / MyApp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-20  |  1.4 KB  |  68 lines

  1. /*    MyApp.h
  2.  *
  3.  *        This declares my application core, which allows me to handle
  4.  *    the new menu commands
  5.  */
  6.  
  7. #ifndef __MYAPP_H__
  8. #define __MYAPP_H__
  9.  
  10. #include <stdio.h>
  11. #include <XApplication.h>
  12. #include <XView.h>
  13. #include <XDynArray.h>
  14.  
  15. /************************************************************************/
  16. /*                                                                        */
  17. /*    Application Core                                                    */
  18. /*                                                                        */
  19. /************************************************************************/
  20.  
  21. /*    TMyApp
  22.  *
  23.  *        This creates a multiwindow application to open text windows
  24.  */
  25.  
  26. class TMyApp : public XGAppMultiWindow, XGViewFactory {
  27.     public:
  28.                                 TMyApp();
  29.         virtual                    ~TMyApp();
  30.         
  31.         long                    ReceiveDispatch(long,long,void *);
  32.         virtual XGView            *CreateView(long viewID, XGView *parent, XGArgStream &);
  33.     private:
  34.         void                    DoOpenWindow();
  35. };
  36.  
  37. /************************************************************************/
  38. /*                                                                        */
  39. /*    Text Display View                                                    */
  40. /*                                                                        */
  41. /************************************************************************/
  42.  
  43. /*    TTextView
  44.  *
  45.  *        This is my display view
  46.  */
  47.  
  48. class TTextView : public XGView {
  49.     public:
  50.                                 TTextView(XGView *parent, XGArgStream &s);
  51.         virtual                    ~TTextView();
  52.         
  53.         /*
  54.          *    Set the view and display
  55.          */
  56.         
  57.         void                    ShowFile(FILE *);
  58.         void                    DoDrawView(Rect);
  59.         void                    DoSizeView();
  60.  
  61.     private:
  62.         void                    RecalcScroll();
  63.         FILE                    *fFile;
  64.         XGDynArray<long>        fStart;
  65. };
  66.  
  67. #endif // __MYAPP_H__
  68.